import 'package:flutter/material.dart';
import 'package:module/chongzhi_page.dart';
import 'package:module/shouzhi_page.dart';

import 'const.dart';
import 'index_page.dart';

class WalletPage extends StatefulWidget {
  const WalletPage({super.key});

  @override
  State<WalletPage> createState() => _WalletPageState();
}

class _WalletPageState extends State<WalletPage> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        backgroundColor: Colors.white,
        centerTitle: true,
        title: Text(
          '我的钱包',
          style: TextStyle(color: Colors.black),
        ),
        leading: GestureDetector(
          onTap: () {
            Navigator.push(context, MaterialPageRoute(builder: (context) {
              return IndexPage();
            }));
          },
          child: Transform.scale(
            scale: 0.5,
            child: Image.asset(
              'assets/icon_back.png',
            ),
          ),
        ),
      ),
      body: Container(
        color: Constants.bgColor,
        padding: const EdgeInsets.symmetric(horizontal: 20),
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.symmetric(
                vertical: 20,
              ),
              padding: const EdgeInsets.symmetric(vertical: 40),
              height: 300,
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(20)),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Column(
                    children: [
                      Text(
                        '${money}0',
                        style: const TextStyle(
                            fontSize: 35,
                            color: Color(0xFFF98B31),
                            fontWeight: FontWeight.bold),
                      ),
                      Text(
                        '总资产(元)',
                        style: TextStyle(fontSize: 22),
                      ),
                    ],
                  ),
                  Container(
                    margin: EdgeInsets.symmetric(horizontal: 20),
                    padding: EdgeInsets.symmetric(horizontal: 20),
                    height: 50,
                    decoration: BoxDecoration(
                        color: Color(0xFFEEEEEE),
                        borderRadius: BorderRadius.circular(20)),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        const Text(
                          '账户余额',
                          style: TextStyle(fontSize: 18, color: Colors.grey),
                        ),
                        Text('$money1元',
                            style: const TextStyle(
                                fontSize: 18, fontWeight: FontWeight.bold)),
                      ],
                    ),
                  ),
                  GestureDetector(
                    onTap: () {
                      Navigator.push(context,
                          MaterialPageRoute(builder: (context) {
                        return ChongZhiPage();
                      }));
                    },
                    child: Container(
                      margin: const EdgeInsets.symmetric(horizontal: 20),
                      padding: const EdgeInsets.symmetric(horizontal: 20),
                      height: 50,
                      decoration: BoxDecoration(
                          color: Color(0xFFF98B31),
                          borderRadius: BorderRadius.circular(20)),
                      child: const Center(
                          child: Text(
                        '充值',
                        style: TextStyle(color: Colors.white, fontSize: 20),
                      )),
                    ),
                  ),
                ],
              ),
            ),
            GestureDetector(
              onTap: () {
                Navigator.push(context, MaterialPageRoute(builder: (context) {
                  return ShouZhiPage();
                }));
              },
              child: Container(
                height: 60,
                padding: EdgeInsets.symmetric(horizontal: 20),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(20),
                ),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(
                      '查看收支历史',
                      style: TextStyle(fontSize: 18),
                    ),
                    Image.asset(
                      'assets/icon_forward.png',
                      width: 24,
                    )
                  ],
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
